<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
	$(document).ready(function() {
		//세션 msgTotal과 현재 pick 메시지 리스트 사이즈 차이값
		var sessionStatus='${sessionScope.mvo.id }';
		if(sessionStatus != ""){
			$.ajax({
				url:"getPickMsgTotal.do",
				dataType:"json",
				data:"id=${sessionScope.mvo.id}",
				success:function(data){
					if(data>0){
						alert("새로운 메시지가 "+data+"개 있습니다.");
						$("#pickMsg").html("<font color='red'>"+data+"</font>");		
					}else{
						$("#pickMsg").html(data);	
					}
				}//success
			});//ajax
		}

		$("#menu").change(function() {
			if ($(this).val() == "mypage") {
				location.href = "${initParam.root}auth_mypageView.do";
			}
			if ($(this).val() == "mybuybook") {
				location.href = "${initParam.root}auth_book_mybuybook_list.do";
			}
			if ($(this).val() == "mysalebook") {
				location.href = "${initParam.root}auth_book_mysalebook_list.do";
			}
			if ($(this).val() == "logout") {
				location.href = "${initParam.root}auth_logoutMember.do";
			}
		});
	});

</script>
<span>
	<a href="book_recent_list.do">
		<b><font face="ubuntu" size="6pt" color="#D5D5D5">pick</font><font face="ubuntu" size="6pt" color="#DB3A00">book</font></b>
	</a>&nbsp;&nbsp;
	<a href="book_salebook_list.do">판매도서</a>&nbsp;&nbsp;|&nbsp;
	<a href="book_buybook_list.do">희망도서</a>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<c:choose>
		<c:when test="${sessionScope.mvo==null }">
			<a href="loginMemberView.do">로그인</a>&nbsp;&nbsp;|&nbsp;
			<a href="registerMemberView.do">회원가입</a>
		</c:when>
		<c:otherwise>
			<a href="auth_pickmsgList.do">[ <img src="${initParam.root }img/alarm.png" style="width:15px;">( <b id="pickMsg"></b> ) ]</a>
			<select id="menu" style="font-family:'맑은 고딕'; background-color:black; border: 0; color: #888; font-size:12pt;">
				<option>${sessionScope.mvo.id }&nbsp;님 반갑습니다. ▼</option>
				<optgroup label="도서 관리">
					<option value="mysalebook">나의판매도서</option>
					<option value="mybuybook">나의희망도서</option>
				</optgroup>
				<optgroup label="회원 관리">
					<option value="mypage">마이페이지</option>
					<option value="logout">로그아웃</option>
				</optgroup>
			</select>
		</c:otherwise>
	</c:choose>
</span>